package com.gy.universities.service.impl;
import com.gy.universities.dao.StudyStudentMapper;
import com.gy.universities.entity.StudyStudent;
import com.gy.universities.service.StudyStudentService;
//import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;

@Component
@Service
public class StudyStudentServiceImpl implements StudyStudentService {

    @Resource
    private StudyStudentMapper studyStudentMapper;

    public StudyStudent getStudyStudentById(String id)throws Exception{
        return studyStudentMapper.getStudyStudentById(id);
    }

    public List<StudyStudent>	getStudyStudentListByMap(Map<String,Object> param)throws Exception{
        return studyStudentMapper.getStudyStudentListByMap(param);
    }

    public Integer getStudyStudentCountByMap(Map<String,Object> param)throws Exception{
        return studyStudentMapper.getStudyStudentCountByMap(param);
    }

    public Integer qdtxAddStudyStudent(StudyStudent studyStudent)throws Exception{
            //studyStudent.setCreatedTime(new Date());
            return studyStudentMapper.insertStudyStudent(studyStudent);
    }

    public Integer qdtxModifyStudyStudent(StudyStudent studyStudent)throws Exception{
        //studyStudent.setUpdatedTime(new Date());
        return studyStudentMapper.updateStudyStudent(studyStudent);
    }

    public Integer qdtxDeleteStudyStudentById(String id)throws Exception{
        return studyStudentMapper.deleteStudyStudentById(id);
    }

    public Integer qdtxBatchDeleteStudyStudent(String ids)throws Exception{
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return studyStudentMapper.batchDeleteStudyStudent(param);
    }


}
